package com.haixiaoke.saas.repository.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.haixiaoke.saas.repository.core.BaseEntity;
import com.haixiaoke.saas.repository.dto.AmountDetailDTO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * 商品的计算数值和商品的类型对象 biz_order_amount_item
 *
 * @author haixiaoke
 * @date 2023-04-17
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class OrderAmountItem extends BaseEntity {
    private static final long serialVersionUID = 1L;

    public static final Integer GOODS_TYPE_HOUSE = 1;   //房屋
    public static final Integer GOODS_TYPE_CLEANING = 2;   //保洁费
    public static final Integer GOODS_TYPE_CASHPLEDGE = 3;   //押金
    public static final Integer GOODS_TYPE_RE_LET = 4;   //续租

    public static final Integer GOODS_REFUND_NO = 0;    //没退款
    public static final Integer GOODS_REFUND_YES = 1;   //退款
    public static final Integer AMOUNT_TYPE_COMMON = 0;   //普通
    public static final Integer AMOUNT_TYPE_SPECIAL = 1;   //特价

//    public static final String REDIS_ORDER_AMOUNT_ITEM = "ORDER_AMOUNT_ID:";

    /**
     * 主键id
     */
    private Long amountItemId;

    /**
     * 订单id
     */
    private String orderId;

    /**
     * 多项金额总额
     */
    private Double totalPrice;

    /**
     * 商品的金额
     */
    private Double goodsAmount;

    /**
     * 购买的数量
     */
    private Double purchaseQuantity;

    /**
     * 单项金额统计
     */
    private Double itemSum;

    /**
     * 商品的类型(1:房屋价格；2:保洁费；3:押金；；4:续租房屋价格)
     */
    private Integer goodsType;

    /**
     * 是否退款（0：没退款；1：已退款）
     */
    private Integer refundType;

    /**
     * 金额计算详细过程
     */
    private String amountDetail;

    /**
     * 订单购买排序
     */
    private Long sort;

    /**
     * 订单退租时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date orderCheckOutTime;

    /**
     * 订单入住时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date orderCheckInTime;

    /**
     * 格式化--金额计算详细过程，自定义字段
     */
    private List<AmountDetailDTO> amountDetailDTOList;

    public OrderAmountItem(Long amountItemId, String orderId, Double totalPrice, Double goodsAmount, Double purchaseQuantity, Double itemSum, Integer goodsType, Integer refundType, String amountDetail, Long sort) {
        this.amountItemId = amountItemId;
        this.orderId = orderId;
        this.totalPrice = totalPrice;
        this.goodsAmount = goodsAmount;
        this.purchaseQuantity = purchaseQuantity;
        this.itemSum = itemSum;
        this.goodsType = goodsType;
        this.refundType = refundType;
        this.amountDetail = amountDetail;
        this.sort = sort;
    }
}